Purpose |
Define a FastProc code section. |
||||||||
Syntax |
FASTPROC ProcName [([arguments])] [THREADSAFE] [AS LONG] [statements...] END FASTPROC [= ReturnValue] |
||||||||
Remarks |
A Fast Procedure (FASTPROC) is a highly simplified form of SUB or FUNCTION which executes much faster than its fully-featured counterparts. It allows a maximum of two numeric LONG arguments, and may optionally return a LONG result. The arguments are always processed as register variables for maximum execution speed. No stack frame is ever created, so there are other limitations detailed below. The programmer may then decide when it is appropriate to accept these trade-offs in exchange for maximum efficiency. All executable code must reside in a Sub, Function, Method, FastProc, or Property block. You cannot define a procedure inside another procedure. A FASTPROC is a subroutine-like block of statements which is invoked with the CALL statement. A FASTPROC may also be invoked without the word CALL, which is then implied. If the CALL word is omitted, the parentheses around the argument list must also be omitted. ProcName must be unique: no variable, Function, Sub, Method, FastProc, Property or label can share the same name. |
||||||||
THREADSAFE |
If you include the option THREADSAFE, PowerBASIC automatically establishes a semaphore which allows only one thread to execute it at a time. Others must wait until the first thread exits the THREADSAFE procedure before they are allowed to begin. |
||||||||
Restrictions |
Most of the restrictions of a FASTPROC stem from the fact that no stack frame is created.
|
||||||||
See also |
DECLARE, EXIT, FUNCNAME$, GLOBAL, INSTANCE, ISMISSING, LOCAL, METHOD, PROPERTY, STATIC, SUB, THREAD CREATE, THREADID, THREADSAFE |